package com.ruoyi.loan.utils;

import com.ruoyi.common.utils.security.Md5Utils;
import com.ruoyi.common.utils.uuid.UUID;

/**
 * @author coderFu
 * @create 2022/4/5
 */
public class PasswordUtils {

    public static final int MIN_PASSWORD_LENGTH = 9;

    public static final int MAX_PASSWORD_LENGTH = 16;



    public static String getEncryptionPassword(String password, String salt){
        String newPassword = password+salt;
        return Md5Utils.hash(newPassword);

    }

    public static String getEncryptionSalt(){
        return UUID.fastUUID().toString().substring(0,3);
    }

    public static  boolean checkPasswordLength(String password){
        return password != null && password.length() >= MIN_PASSWORD_LENGTH && password.length() <= MAX_PASSWORD_LENGTH;
    }

}
